package com.yzf.wisecoder.wisecoderservice.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yzf.wisecoder.wisecoderstorage.mysql.entity.RoleEntity;

import java.util.List;
import java.util.Map;

/**
 * @author jianghuiyong
 * @email jianghuiyong@yunzhangfang.com
 * @date 2020-05-06 17:43:12
 */
public interface RoleService extends IService<RoleEntity> {

    IPage<RoleEntity> queryPage(Map<String, Object> params);

    List<RoleEntity> queryList(Map<String, Object> params);

    boolean saveOrUpdateRole(RoleEntity roleEntity);

    /**
     * 查询用户的全局角色
     *
     * @param userId
     * @param tenantId
     * @return
     */
    List<RoleEntity> queryUserRoles(Long userId, Long tenantId);

    /**
     * 判断用户会否拥有全局管理员角色
     *
     * @param userId
     * @param tenantId
     * @return
     */
    boolean hasAdmin(Long userId, Long tenantId);
}

